<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>系统首页</title>
    <link rel="stylesheet" href="{$CSS}/bootstrap3.3.7.min.css">
    <style>
    </style>
	<script type="text/javascript">
$(function(){
	var np = $.trim($('#fnopages').val());
	var nps = np.split(',');
	for(var i=0;i<nps.length;i++){
		$('input[name="'+nps[i]+'"]').prop('checked',false);
	}
	
	$('input[type="checkbox"]').click(function(){
		if($(this).prop('checked')){
			 remprop($(this).attr('name'));
		}else{
			addprop($(this).attr('name'));
		}
	});
	$('#Form1').submit(function(){
		var na = [];
		$('input[type="checkbox"]').each(function(){
			if(!$(this).prop('checked')){
				na[na.length] = $(this).attr('name');
			}			
		});
		$('#fnopages').val(na.join(','));
		return true;
	});
});
function remprop(name){
	var np = $.trim($('#fnopages').val());
	np = np.replace(name+',','').replace(','+name,'').replace(name,'');
	$('#fnopages').val(np);
}
function addprop(name){
	remprop(name);
	var np = $.trim($('#fnopages').val());
	if(np==''){
		np = name;
	}else{
		np = np+','+name;
	}
	$('#fnopages').val(np);
}

</script>	
</head>

<body>
    <div style="padding:10px;border-bottom:1px solid #eee;font-size:15px;font-weight:700">用户套餐权限设置（未勾选功能将不在用户后台显示）
</div>
    <div style="padding:20px">
        <form class="form-inline" method="post" action="" name="Form" id="Form1">
            <div class="form-group">
                <label for="exampleInputEmail2">用户级别</label>
				{$m->select($dl_arr,'typid','onchange="goto(\'quanxian-\'+$(this).val()+\'.html\')" class="form-control"')}	
            </div>
            <button type="submit" class="btn btn-primary">保存</button>
			{$m->textarea('nopages',' style="display:none;"')}
        </form>
        <div style="margin-top:15px">
            <div class="panel panel-primary">
			 {loop $index as $k=>$m}
              <div class="panel-heading">
                <h3 class="panel-title">{$m['name']}</h3>
              </div>
              <div class="panel-body">		
			   {loop $m['sub'] as $kk=>$mm}			  
			 <label class="radio-inline">
                 <input type='checkbox' name='{$mm['file']}' value='1' checked="checked"/>&nbsp;&nbsp;{$mm['name']}&nbsp;&nbsp;
             </label>
			   {/loop}
              </div>
			{/loop} 
            </div>
        </div>
    </div>	
</body>
</html>